const AppError = require('../utils/AppError');

// 校验参数中的id
exports.visParamsId = (req, res, next) => {
	const schema = req.joi
		.object({
			id: req.joi.string().regex(/^\d+$/).required()
		})
		.unknown(true)
		.messages(req.joimsg);
	const { error } = schema.validate(req.params);
	if (error) next(new AppError(error, 400));

	next();
};
